﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

public class Camera
{
    /// <summary>
    /// Position der Kamera.
    /// </summary>
    public Vector2 Position
    {
        get { return position; }
        set { position = value; }
    }
    private Vector2 position;

    public void Update(GameTime gameTime)
    {
        float elapsed = (float)gameTime.ElapsedGameTime.TotalSeconds;
        KeyboardState kbState = Keyboard.GetState();

        // Kamera bewegen
        if (kbState.IsKeyDown(Keys.Left))
        {
            position.X += 500.0f * elapsed;
        }
        if (kbState.IsKeyDown(Keys.Right))
        {
            position.X -= 500.0f * elapsed;
        }
        if (kbState.IsKeyDown(Keys.Up))
        {
            position.Y += 500.0f * elapsed;
        }
        if (kbState.IsKeyDown(Keys.Down))
        {
            position.Y -= 500.0f * elapsed;
        }
    }

    public Matrix GetMatrix()
    {
        return Matrix.CreateTranslation(new Vector3(position, 0));
    }
}